package com.yunhai.device.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.device.service.CrrCleaningSummaryReportService;
import com.yunhai.model.entity.crr.CrrCleaningSummaryReportEntity;
import com.yunhai.model.vo.crr.CrrCleaningSummaryReportQuery;
import com.yunhai.model.vo.crr.CrrCleaningSummaryReportVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/crrCleaningSummaryReport")
public class CrrCleaningSummaryReportController {

	@Resource
	private CrrCleaningSummaryReportService crrCleaningSummaryReportService;


	/**
	 * 获取 CrrCleaningSummaryReport 分页列表
	 */
	@GetMapping("/pagination")
	public Ret getCrrCleaningSummaryReportPagination(PaginationVo paginationVo, CrrCleaningSummaryReportQuery crrCleaningSummaryReportQuery ) throws Exception {
		IPage page = crrCleaningSummaryReportService.getCrrCleaningSummaryReportPagination(paginationVo, crrCleaningSummaryReportQuery );
		return Ret.toPage(page);
	}


	/**
	 * 获取 CrrCleaningSummaryReport 所有数据
	 */
	@GetMapping("/allList")
	public Ret getCrrCleaningSummaryReportAllList( CrrCleaningSummaryReportQuery crrCleaningSummaryReportQuery ) throws Exception {
		List<CrrCleaningSummaryReportEntity> list = crrCleaningSummaryReportService.getCrrCleaningSummaryReportAllList( crrCleaningSummaryReportQuery );
		return Ret.ok(list);
	}


	/**
	 * 获取 CrrCleaningSummaryReport 详情
	 */
	@GetMapping("/{id}")
	public Ret getCrrCleaningSummaryReportDetailById(@PathVariable Long id) throws Exception {

	    CrrCleaningSummaryReportEntity crrCleaningSummaryReportEntity = crrCleaningSummaryReportService.getCrrCleaningSummaryReportDetail(id);
		return Ret.ok(crrCleaningSummaryReportEntity);
	}


	/**
	 * 新增 CrrCleaningSummaryReport
	 * */
	@PostMapping("")
	public Ret addCrrCleaningSummaryReport(@RequestBody CrrCleaningSummaryReportVo crrCleaningSummaryReportVo) throws Exception {

		crrCleaningSummaryReportService.addCrrCleaningSummaryReport(crrCleaningSummaryReportVo);
		return Ret.ok();
	}


	/**
	 * 更新 CrrCleaningSummaryReport
	 * */
	@PutMapping("")
	public Ret updateCrrCleaningSummaryReport(@RequestBody CrrCleaningSummaryReportVo crrCleaningSummaryReportVo) throws Exception {

		crrCleaningSummaryReportService.updateCrrCleaningSummaryReport(crrCleaningSummaryReportVo);
		return Ret.ok();
	}


	/**
	 * 删除 CrrCleaningSummaryReport
	 * */
	@PostMapping("/batchRemove")
	public Ret batchRemoveCrrCleaningSummaryReport( @RequestBody List<Long> ids ) throws Exception {

	    crrCleaningSummaryReportService.batchRemoveCrrCleaningSummaryReport(ids);
		return Ret.ok();
	}
}
